/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.ro.model.entity;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 
 * @author L941859
 */
@Entity
@Table(name = "objetoocorrencia")
public class ObjetoOcorrencia implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Basic(optional = false)
	@Column(name = "id")
	private Integer id;
	@Column(name = "descricao")
	private String descricao;
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "objetoOcorrenciaid")
	private Collection<Ocorrencia> ocorrenciaCollection;
	@JoinColumn(name = "projeto_id", referencedColumnName = "id")
	@ManyToOne(optional = false)
	private Projeto projetoId;

	public ObjetoOcorrencia() {
	}

	public ObjetoOcorrencia(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public Collection<Ocorrencia> getOcorrenciaCollection() {
		return ocorrenciaCollection;
	}

	public void setOcorrenciaCollection(Collection<Ocorrencia> ocorrenciaCollection) {
		this.ocorrenciaCollection = ocorrenciaCollection;
	}

	public Projeto getProjetoId() {
		return projetoId;
	}

	public void setProjetoId(Projeto projetoId) {
		this.projetoId = projetoId;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof ObjetoOcorrencia)) {
			return false;
		}
		ObjetoOcorrencia other = (ObjetoOcorrencia) object;
		if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "br.com.ro.model.entity.ObjetoOcorrencia[ id=" + id + " ]";
	}

}
